commonlibsse_ng\re\t\TESForm/
vtable.rs

1use super::TESForm;
2use crate::re::BGSLoadFormBuffer::BGSLoadFormBuffer;
3use crate::re::BGSSaveFormBuffer::BGSSaveFormBuffer;
4use crate::re::BSCoreTypes::FormID;
5use crate::re::BSFixedString::BSFixedString;
6use crate::re::FORM::{FORM, FORM_GROUP};
7use crate::re::FormTypes::FormType;
8use crate::re::TESBoundObject::TESBoundObject;
9use crate::re::TESFile::TESFile;
10use crate::re::TESObjectREFR::TESObjectREFR;
11use core::ffi::c_char;
12
13/// Virtual function table for `TESForm`
14#[repr(C)]
15#[derive(Debug)]
16pub struct TESFormVtbl {
17    /// # C++
18    /// - method nth: 0x00
19    /// - Destructor `~TESForm`
20    pub CxxDrop: fn(this: &mut TESForm),
21
22    /// # C++
23    /// - method nth: 0x01
24    /// - { return; }
25    pub InitializeDataComponent: fn(this: &mut TESForm),
26
27    /// # C++
28    /// - method nth: 0x02
29    /// - { SetEditorID(""); }
30    pub ClearDataComponent: fn(this: &mut TESForm),
31
32    /// # C++
33    /// - method nth: 0x03
34    pub CopyComponent: fn(this: &mut TESForm, rhs: *const TESForm),
35
36    /// # C++
37    /// - method nth: 0x04
38    /// - { return; }
39    pub InitializeData: fn(this: &mut TESForm),
40
41    /// # C++
42    /// - method nth: 0x05
43    /// - { return; }
44    pub ClearData: fn(this: &mut TESForm),
45
46    /// # C++
47    /// - method nth: 0x06
48    /// - { return true; }
49    pub Load: fn(this: &mut TESForm, mod_file: *mut TESFile) -> bool,
50
51    /// # C++
52    /// - method nth: 0x07
53    /// - { return true; }
54    pub LoadPartial: fn(this: &mut TESForm, mod_file: *mut TESFile) -> bool,
55
56    /// # C++
57    /// - method nth: 0x08
58    /// - { return Load(mod); }
59    pub LoadEdit: fn(this: &mut TESForm, mod_file: *mut TESFile) -> bool,
60
61    /// # C++
62    /// - method nth: 0x09
63    pub CreateDuplicateForm:
64        fn(this: &mut TESForm, create_editor_id: bool, arg2: *mut ()) -> *mut TESForm,
65
66    /// # C++
67    /// - method nth: 0x0A
68    pub AddChange: fn(this: &mut TESForm, change_flags: u32) -> bool,
69
70    /// # C++
71    /// - method nth: 0x0B
72    pub RemoveChange: fn(this: &mut TESForm, change_flags: u32),
73
74    /// # C++
75    /// - method nth: 0x0C
76    /// - { return false; }
77    pub FindInFileFast: fn(this: &mut TESForm, mod_file: *mut TESFile) -> bool,
78
79    /// # C++
80    /// - method nth: 0x0D
81    /// - { return true; }
82    pub CheckSaveGame: fn(this: &mut TESForm, buf: *mut BGSSaveFormBuffer) -> bool,
83
84    /// # C++
85    /// - method nth: 0x0E
86    pub SaveGame: fn(this: &TESForm, buf: *mut BGSSaveFormBuffer),
87
88    /// # C++
89    /// - method nth: 0x0F
90    pub LoadGame: fn(this: &mut TESForm, buf: *mut BGSLoadFormBuffer),
91
92    /// # C++
93    /// - method nth: 0x10
94    /// - { return; }
95    pub InitLoadGame: fn(this: &mut TESForm, buf: *mut BGSLoadFormBuffer),
96
97    /// # C++
98    /// - method nth: 0x11
99    /// - { return; }
100    pub FinishLoadGame: fn(this: &mut TESForm, buf: *mut BGSLoadFormBuffer),
101
102    /// # C++
103    /// - method nth: 0x12
104    /// - { return; }
105    pub Revert: fn(this: &mut TESForm, buf: *mut BGSLoadFormBuffer),
106
107    /// # C++
108    /// - method nth: 0x13
109    /// - { return; }
110    pub InitItemImpl: fn(this: &mut TESForm),
111
112    /// # C++
113    /// - method nth: 0x14
114    pub GetDescriptionOwnerFile: fn(this: &TESForm) -> *mut TESFile,
115
116    /// # C++
117    /// - method nth: 0x15
118    /// - { return formType; }
119    pub GetSavedFormType: fn(this: &TESForm) -> FormType,
120
121    /// # C++
122    /// - method nth: 0x16
123    pub GetFormDetailedString: fn(this: &TESForm, buf: *mut c_char, buf_len: u32),
124
125    /// # C++
126    /// - method nth: 0x17
127    /// - { return (flags >> 6) & 1; }
128    pub GetKnown: fn(this: &TESForm) -> bool,
129
130    /// # C++
131    /// - method nth: 0x18
132    /// - { return (flags >> 16) & 1; }
133    pub GetRandomAnim: fn(this: &TESForm) -> bool,
134
135    /// # C++
136    /// - method nth: 0x19
137    /// - { return (flags >> 2) & 1; }
138    pub GetPlayable: fn(this: &TESForm) -> bool,
139
140    /// # C++
141    /// - method nth: 0x1A
142    /// - { return false; }
143    pub IsHeadingMarker: fn(this: &TESForm) -> bool,
144
145    /// # C++
146    /// - method nth: 0x1B
147    /// - { return (flags >> 17) & 1; }
148    pub GetDangerous: fn(this: &TESForm) -> bool,
149
150    /// # C++
151    /// - method nth: 0x1C
152    /// - { return (flags >> 19) & 1; }
153    pub QHasCurrents: fn(this: &TESForm) -> bool,
154
155    /// # C++
156    /// - method nth: 0x1D
157    /// - { return (flags >> 25) & 1; }
158    pub GetObstacle: fn(this: &TESForm) -> bool,
159
160    /// # C++
161    /// - method nth: 0x1E
162    /// - { return false; }
163    pub QIsLODLandObject: fn(this: &TESForm) -> bool,
164
165    /// # C++
166    /// - method nth: 0x1F
167    /// - { return (flags >> 9) & 1; }
168    pub GetOnLocalMap: fn(this: &TESForm) -> bool,
169
170    /// # C++
171    /// - method nth: 0x20
172    /// - { return (flags >> 8) & 1; }
173    pub GetMustUpdate: fn(this: &TESForm) -> bool,
174
175    /// # C++
176    /// - method nth: 0x21
177    /// - { if (set) flags &= 0xFFFFFDFF; else flags |= 0x200; }
178    pub SetOnLocalMap: fn(this: &mut TESForm, set: bool),
179
180    /// # C++
181    /// - method nth: 0x22
182    /// - { return false; }
183    pub GetIgnoredBySandbox: fn(this: &TESForm) -> bool,
184
185    /// # C++
186    /// - method nth: 0x23
187    /// - { bool result = (flags >> 5) & 1; if (result != set) { if (set) flags |= 0x20; else flags &= 0xFFFFFFDF; AddChange(1); return result; }
188    pub SetDelete: fn(this: &mut TESForm, set: bool),
189
190    /// # C++
191    /// - method nth: 0x24
192    pub SetAltered: fn(this: &mut TESForm, set: bool),
193
194    /// # C++
195    /// - method nth: 0x25
196    /// - { return; }
197    pub SaveObjectBound: fn(this: &mut TESForm),
198
199    /// # C++
200    /// - method nth: 0x26
201    /// - { return; }
202    pub LoadObjectBound: fn(this: &mut TESForm, mod_: *mut TESFile),
203
204    /// # C++
205    /// - method nth: 0x27
206    /// - { return false; }
207    pub IsBoundObject: fn(this: &TESForm) -> bool,
208
209    /// # C++
210    /// - method nth: 0x28
211    /// - { return false; }
212    pub IsObject: fn(this: &TESForm) -> bool,
213
214    /// # C++
215    /// - method nth: 0x29
216    /// - { return false; }
217    pub IsMagicItem: fn(this: &TESForm) -> bool,
218
219    /// # C++
220    /// - method nth: 0x2A
221    /// - { return false; }
222    pub IsWater: fn(this: &TESForm) -> bool,
223
224    /// # C++
225    /// - method nth: 0x2B
226    /// - { return 0; }
227    pub AsReference1: fn(this: &mut TESForm) -> *mut TESObjectREFR,
228
229    /// # C++
230    /// - method nth: 0x2C
231    /// - { return 0; }
232    pub AsReference2: fn(this: &TESForm) -> *const TESObjectREFR,
233
234    /// # C++
235    /// - method nth: 0x2D
236    /// - { return 0; }
237    pub GetRefCount: fn(this: &TESForm) -> u32,
238
239    /// # C++
240    /// - method nth: 0x2E
241    pub GetTextForParsedSubTag: fn(this: &TESForm, tag: &BSFixedString) -> *const c_char,
242
243    /// # C++
244    /// - method nth: 0x2F
245    /// - { return; }
246    pub Copy: fn(this: &mut TESForm, src_form: *const TESForm),
247
248    /// # C++
249    /// - method nth: 0x30
250    pub BelongsInGroup: fn(
251        this: &TESForm,
252        form: *const FORM,
253        allow_parent_groups: bool,
254        current_only: bool,
255    ) -> bool,
256
257    /// # C++
258    /// - method nth: 0x31
259    pub CreateGroupData: fn(this: &TESForm, form: *const FORM, group: *mut FORM_GROUP),
260
261    /// # C++
262    /// - method nth: 0x32
263    /// - { return ""; }
264    pub GetFormEditorID: fn(this: &TESForm) -> *const c_char,
265
266    /// # C++
267    /// - method nth: 0x33
268    /// - { return true; }
269    pub SetFormEditorID: fn(this: &mut TESForm, str: *const c_char) -> bool,
270
271    /// # C++
272    /// - method nth: 0x34
273    /// - { return false; }
274    pub IsParentForm: fn(this: &TESForm) -> bool,
275
276    /// # C++
277    /// - method nth: 0x35
278    /// - { return false; }
279    pub IsParentFormTree: fn(this: &TESForm) -> bool,
280
281    /// # C++
282    /// - method nth: 0x36
283    /// - { return false; }
284    pub IsFormTypeChild: fn(this: &TESForm, type_: FormType) -> bool,
285
286    /// # C++
287    /// - method nth: 0x37
288    /// - { return false; }
289    pub Activate: fn(
290        this: &mut TESForm,
291        target_ref: *mut TESObjectREFR,
292        activator_ref: *mut TESObjectREFR,
293        arg3: u8,
294        object: *mut TESBoundObject,
295        target_count: i32,
296    ) -> bool,
297
298    /// # C++
299    /// - method nth: 0x38
300    pub SetFormID: fn(this: &mut TESForm, id: FormID, update_file: bool),
301
302    /// # C++
303    /// - method nth: 0x39
304    /// - { return ""; }
305    pub GetObjectTypeName: fn(this: &TESForm) -> *const c_char,
306
307    /// # C++
308    /// - method nth: 0x3A
309    /// - { return true; }
310    pub QAvailableInGame: fn(this: &TESForm) -> bool,
311}
312const _: () = {
313    const VFUNC_COUNT: usize = 0x3A + 1;
314
315    const EXPECTED_SIZE: usize = VFUNC_COUNT * core::mem::size_of::<usize>();
316    const ACTUAL_SIZE: usize = core::mem::size_of::<TESFormVtbl>();
317    assert!(ACTUAL_SIZE == EXPECTED_SIZE);
318};